import { Controller, Get, Post, Body, Patch, Param, Delete, UseGuards, Req, HttpCode, HttpStatus } from '@nestjs/common';
import { ApartmentUserService } from './apartment-user.service';
import { CreateApartmentUserDto } from './dto/create-apartment-user.dto';
import { UpdateApartmentUserDto } from './dto/update-apartment-user.dto';
import { UserProfileDto } from './dto/user-profile.dto';

@Controller('apartment-user')
export class ApartmentUserController {
  constructor(private readonly apartmentUserService: ApartmentUserService) {}

  @Post()
  @HttpCode(HttpStatus.CREATED)
  create(@Body() createApartmentUserDto: CreateApartmentUserDto): Promise<UserProfileDto> {
    return this.apartmentUserService.create(createApartmentUserDto);
  }

  @Get()
  findAll(): Promise<UserProfileDto[]> {
    return this.apartmentUserService.findAll();
  }

  @Get('profile/:id')
  findOne(@Param('id') id: string): Promise<UserProfileDto> {
    return this.apartmentUserService.findOne(id);
  }

  @Patch(':id')
  update(
    @Param('id') id: string, 
    @Body() updateApartmentUserDto: UpdateApartmentUserDto
  ): Promise<UserProfileDto> {
    return this.apartmentUserService.update(id, updateApartmentUserDto);
  }

  @Delete(':id')
  @HttpCode(HttpStatus.NO_CONTENT)
  remove(@Param('id') id: string): Promise<void> {
    return this.apartmentUserService.remove(id);
  }
}
